//
//  UserPresenter.m
//  MVPTableViewDemo
//
//  Created by 胡锦涛 on 2019/1/27.
//  Copyright © 2019 胡锦涛. All rights reserved.
//

#import "UserPresenter.h"

@implementation UserPresenter
-(void)getUsers {
    __weak typeof(self) weakSelf = self;
    [User getUsers:^(NSArray<User *> * _Nonnull users) {
        [weakSelf.delegate finishLoading];
        BOOL hasUser = users && users.count;
        if (!hasUser) {
            [weakSelf.delegate setEmptyUsers];
        }else {
            //将数据传出到控制器
            if ([self.delegate respondsToSelector:@selector(setUsers:)]) {
                [self.delegate setUsers:users];
            }
        }
    }];
}
@end
